import Vue from 'vue'
import App from './App.vue'
import api from './api'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import router from './router'
import storage from './utils/storage'
import converters from '@/converts'
import store from './store'
import './assets/css/common.less'
import './assets/css/reset.less'
import 'font-awesome/css/font-awesome.min.css'
import prototype from '@/prototype'

Vue.prototype.$bus = new Vue()
Vue.prototype.$converters = converters
// 将api作为vue的一个属性可访问
Vue.prototype.$api = api

Vue.use(ElementUI)

Vue.config.productionTip = false

// let loadingInstance
//
// router.beforeEach((to, from, next) => {
//   loadingInstance = ElementUI.Loading.service({
//     lock: true,
//     text: 'Loading',
//     spinner: 'el-icon-loading',
//     background: 'rgba(0, 0, 0, 0.7)'
//   })
//   next()
// })
//
// router.afterEach(() => {
//   if (loadingInstance) {
//     loadingInstance.close()
//   }
// })

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
